//渲染用户名
getUsername()
//判断是否登录
checkLogin()


new Vue({
    el: '#app',
    data: {
        overview: {}
    },
    methods: {
        //退出登录
        logout() {
            localStorage.removeItem('vusername')
            localStorage.removeItem('hmvToken')
            show('欢迎下次再来')
            setTimeout(e => {
                location.href = './login.html'
            }, 1500)
        },

        //获取overview数据
        async getOverviewData() {
            try {
                const res = await axios({
                    url: '/dashboard'
                })
                this.overview = res.data.overview
                console.log(this.overview)
            } catch (error) {
                console.dir(error);
            }
        }
    },
    created() {
        this.getOverviewData()
    }
})